import {formatDate} from "../../../utils/util";

Component({
    properties: {},
    data: {
        dialogShow: false,
        record: {
            follow_time: null,
            opposite_person: null,// 对接人
            phone: null,// 手机号
            achievements: null,// 达成成果
            reasons_for_recommendation: null,// 拜访目的
            action_list: [],// 推进动作
            resource_list: [],//推荐资源
            url_list: []// 照片
        },
        selectLinkUserPopup: false,
        calendarShow: false,
        columns: ['张三', '李四', '王五']
    },
    methods: {
        preventTouchMove() {

        },
        dialogClose() {

        },
        onFunnelsChange(e) {
            this.setData({
                'record.action_list': e.detail
            })
            console.log(this.record.action_list)
        },
        onResourceChange(e) {
            this.setData({
                'record.resource_list': e.detail
            })
        },
        removeImg(e) {
            let index = e.detail.index;
            this.data.record.url_list.splice(index, 1)
            this.setData({
                'record.url_list': this.data.record.url_list
            })
        },
        showCalendar() {
            this.setData({
                calendarShow: true
            })
        },
        onCalendarClose() {
            this.setData({
                calendarShow: false
            })
        },
        onCalendarConfirm(e) {
            this.setData({
                'record.follow_time': formatDate(e.detail),
                calendarShow: false
            })
        },
        showLinkUserPopup() {
            this.setData({
                selectLinkUserPopup: true,
            })
        },
        confirmLinkUser(e) {
            this.setData({
                'record.opposite_person': e.detail.value,
                selectLinkUserPopup: false,
            })
        },
        cancelLinkUser(e) {
            this.setData({
                selectLinkUserPopup: false,
            })
        },
        showDialog() {
            this.setData({
                dialogShow: true,
            })
        }
    }
});
